<?php 
	$controller	= $this->uri->segment(1);
	$function 	= $this->uri->segment(2);
	$login 		= $this->session->userdata('login');
	$modulos	= $this->config->item('modulos');
	$bodega		= $this->session->userdata('bodega');
	
	
	if(!isset($title)){
		$title = ucwords($bodega) . " - ";
		$title .= ( ($controller == 'inicio') XOR (empty($conroller)) ) ? 'Sistema De Bodega' : ucwords($controller) ;
	}
	
	//chequeamos que el usuario este logeado
	if(empty($login)){
		$log = "no logeado";
		
		//mostramos el logo y la barra de login
		$top_navi     = 'login';
		$modulos_navi = 'modulos_navi';
		$main_content = 'logofull';
	
	}else{
	//generamos o buscamos los datos para el resto de los modulos
	$log = 'logeado';
	
	$top_navi='login';
	
	$modulos_navi = 'modulos_navi';
	$main_content = 'logofull';
	}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
	<link rel='shortcut icon' href='../image/favdcs.png'/>

	<link rel='stylesheet' type='text/css' href='../css/style.css'/>
	
	<script type='text/javascript' src='../js/script.js'></script>
	<script type='text/javascript' src='../js/script-2.js'></script>
	<script type='text/javascript' src='../js/onload.js'></script>
	
	<title><?php echo $title; ?></title>
</head>

<body>

<div id='header'>
  <div class='container full'>
		<div class='head_content'>
			<div id='logo' class='top'><img src='../image/logo.png' alt='logo' width="128" height="29" /></div>
			<div id='head_data'>
			
			<?php
			//barra de estado/navegacion superior			
			$this->load->view($top_navi);
			
			?>
			 
			</div>
		</div>
  </div>
</div>

<div id='main'>
	<div class='container'>
	  <div id='navigation'>
	  	
		<ul id='nav'>
          	<li><a href='<?php echo base_url()."inicio";?>' <?php if( $controller == "" OR $controller == 'inicio' ) echo "class='active'"; ?>>Inicio</a></li>
	      	<?php foreach($modulos as $key => $value) :?>
			<?php 	if(in_array($bodega,$value)):?>
			<li><a href='<?php echo base_url().$key;?>' <?php if( ($key == $controller) ) echo "class='active'"; ?>><?php echo $key;?></a></li>
			<?php 	endif;?>
			<?php endforeach;?>
			
	
		</ul>
		
	  </div>
		<div class='content'>
			<div id='main_content'>
			
				<br>
				<?php echo $log ." -- ".$bodega ."<br>". md5('comunal');?>
				<?php $this->load->view($main_content);?>
				<br>
				
				<div >
				<?php echo form_open();?>
				
				<p>
				<spam>
				<?php echo form_label('hola','mundo');?>
				<?php echo form_input(array('name' => 'dfg', 'title' => 'Nombre De Usuario', 'value' => 'asdasdasd',));?>
				</spam>
				<spam>
				<?php echo form_label('hola','mundo');?>
				<?php echo form_input(array('name' => 'dfg', 'title' => 'Nombre De Usuario', 'value' => 'asdasdasd',));?>
				</spam>
				</p>
				
				
				
				<br>
				<?php echo form_close();?>
				</div>
				
		</div>
	</div>
</div>

<div id='footer'>
	<div class='container'>
	  <p><img src='../image/logo-dcs.png' alt='imagen' width='114' height='34' /></p>
	  <p>Sistema para la gestion de Bodega</p>
	  <p>Direccion Comunal de Talca</p>
	  <p>2011</p>
	</div>
</div>

</body>
</html>